Re: [INTERFACES] compile error
От | Herouth Maoz |
---|---|
Тема | Re: [INTERFACES] compile error |
Дата | |
Msg-id | l03110703b1be52371ef6@[147.233.159.109] обсуждение исходный текст |
Ответ на | compile error ("rony khoury" <rkhoury@apotres.edu.lb>) |
Ответы |
Re: [INTERFACES] compile error
|
Список | pgsql-interfaces |
At 10:23 +0300 on 30/6/98, rony khoury wrote: > can somebody explain to me why when I compile the following program i do > not know > how to link the libraries to c . Rony, in order to write Database-related CGIs in C, you first have to have some understanding of, well, C. Then, you have to understand CGIs. Eventually, you also have to understand the database on which you work, and the interface in C. In this case, your problem is that you don't know how to link a library to a C program. This is really not related to Postgres. The answer is that any library you want to add to the final program has to appear with a "-l<libname>" (no space) in the final cc (the one that creates the main program). You have really a lot of work ahead of you. My suggestion to you is not to choose C as the CGI language. Despite being more efficient from the computer resources point of view, it is not good for learning, and its handling of strings (the main issue in CGIs) is very poor. I'd recommend Perl, if you don't want to use PHP or another rapid-development tool. If you insist on working in C, try compiling with the libpq library. Ask yourself the following questions: 1. Do you know how to compile and link complex project in C? Use make? What the compilation does and what the link does? 2. Do you know how form parameters are transferred from an page in a browser to a CGI program in general? What the difference is between GET and POST? Why the raw data that is passed needs "parsing"? 3. Now, do you have a good CGI-data parsing mechanism for C? One that will give you the name-value pairs, and allow you to get multiple values, if there are any? If you don't have a library, or have trouble in using it, you really should choose a different language. 4. Now, the postgreSQL interface. At this stage, you have to make sure that you know which files to include and which libraries to link. You also have to understand how to pass parameters to the SQL commands passed through the various pq calls. Do you how to convert a number and embed the resulting string in a query? 5. Do you know the problems of CGI and real-world applications? Do you know CGI is stateless? That it means that no information is kept from what the user passed to the CGI? Do you know that you have to take care of it yourself? Maintain some sort of "session" information and have some way of knowing that the client that connects now to the database is the same client that connected to it three minutes ago and started some work? If you want the user to be able to do several consecutive screens, like read-and-update, you have to think about this problem, and find a solution for it. Also think about multi- user scenarios. I'm assuming you know how to plan your database and create the appropriate tables. Now work on this, step by step. Don't try to understand all of it together. I learned most of the above from reading, and almost didn't need any help from the mailing list. The mailing list is not a place to learn things, but rather to get help in specific, focused points. Herouth -- Herouth Maoz, Internet developer. Open University of Israel - Telem project http://telem.openu.ac.il/~herutma
В списке pgsql-interfaces по дате отправления: